package com.lge.test;

import java.util.ArrayList;

import com.lge.test.R;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.TextureView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends Activity {

	ArrayList<String []> values = new ArrayList<String []>();
	protected static MyLocation loc;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        Log.d("ArthurDebug","onCreate()");
        
        loc = new MyLocation(this);
        
        Button finishB = (Button) findViewById(R.id.finish);
        finishB.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) { finish(); }
		});
        
        create_values();
        
        ListView listview = (ListView) findViewById(R.id.mainlist);
        listview.setAdapter(new RestarauntAdapter(this, values));
    }
    
    public MyLocation getLocation() {
    	return loc;
    }

    private void create_values() {
    	String[] mcdonald = {"mcdonald","mcdonald","McDonald","had a farm"};
    	String[] applebees = {"applebees","applebees","Applebee's","that busy bee"};
    	String[] burgerking = {"burgerking","burgerking","Burger King","is a king"};
    	String[] carlsjr = {"carlsjr","carlsjr","Carl's Jr.","is carl's son"};
    	String[] subway = {"subway","subway","Subway","eat fresh"};
    	values.add(mcdonald);
    	values.add(applebees);
    	values.add(burgerking);
    	values.add(carlsjr);
    	values.add(subway);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    @Override
    protected void onSaveInstanceState(Bundle outState) {
    	super.onSaveInstanceState(outState);
    	Log.d("ArthurDebug","onSaveInstanceState()");
    }
    
    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
    	super.onRestoreInstanceState(savedInstanceState);
    	Log.d("ArthurDebug","onSaveInstanceState()");
    }
    
    @Override
    protected void onDestroy() {
    	super.onDestroy();
    	Log.d("ArthurDebug","onDestroy()");
    }
    
    @Override
    protected void onPause() {
    	loc.stopGPS();
    	super.onPause();
    	Log.d("ArthurDebug","onPause()");
    }
    
    @Override
    protected void onRestart() {
    	super.onRestart();
    	Log.d("ArthurDebug","onRestart()");
    }
    
    @Override
    protected void onResume() {
    	loc.startGPS();
    	super.onResume();
    	Log.d("ArthurDebug","onResume()");
    }
    
    @Override
    protected void onStart() {
    	super.onStart();
    	
    	Log.d("ArthurDebug","onStart()");
    }
    
    @Override
    protected void onStop() {
    	super.onStop();
    	Log.d("ArthurDebug","onStop()");
    }
    
    
}
